<template>
  <div class="container">
    <el-dialog title="审核" :visible.sync="show" width="900px">
      <el-form size="small">
        <el-form-item>
          <el-radio :label="1" v-model="myDate.chkState">通过</el-radio>
          <el-radio :label="2" v-model="myDate.chkState">拒绝</el-radio>
        </el-form-item>
        <el-form-item>
          <el-input type="textarea" v-model="myDate.chkRemarks" placeholder="请输入审核意见"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="show=false">取消</el-button>
        <el-button @click="confirm()" type="primary">确认</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { audit } from '@/api/hmmm/questions'
export default {
  props: {
    date: {
      type: Object,
      require: true,
    },
  },
  data() {
    return {
      myDate: {
        id: null,
        chkState: 1,
        chkRemarks: null,
      },
      show: false,
    }
  },
  methods: {
    open() {
      this.show = true
    },
    async confirm() {
      if (!this.myDate.chkRemarks) {
        return this.$message('审核意见不能为空')
      }
      this.myDate.id = this.date.id
      await audit(this.myDate)
      this.$message.success('操作成功')
      this.show = false
      //更新视图
    },
  },
}
</script>

<style scoped lang='less'>
</style>
